<%@page import="com.xxb.entity.User"%>
<%@page import="com.xxb.dao.CommentDao"%>
<%@page import="com.xxb.util.DateUtil"%>
<%@page import="com.xxb.entity.Comment"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	
	String content = request.getParameter("content");
	String pid = request.getParameter("pid");
	
	User user = (User)session.getAttribute("curruser");
		if(user != null){
		Comment comment = new Comment();
		comment.setComtime(DateUtil.getTime());
		comment.setContent(content);
		comment.setPid(Integer.parseInt(pid));
		comment.setUid(user.getId());
		
		int rows = new CommentDao().save(comment);
		if(rows > 0){
			
			response.sendRedirect("l_x1.jsp?id="+pid);
		}
	}else{
		response.sendRedirect("l_to_login.jsp?code=111");
	}
%>